package com.student.score.entity;

public class Score {
    private Student student; // 关联学生
    private Course course;   // 关联课程
    private int score;       // 分数

    public Score(Student student, Course course, int score) throws IllegalArgumentException {
        this.student = student;
        this.course = course;
        setScore(score);
    }

    public void setScore(int score) {
        if (score < 0 || score > 100) {
            throw new IllegalArgumentException("分数无效！必须在0-100之间");
        }
        this.score = score;
    }

    public Student getStudent() { return student; }
    public Course getCourse() { return course; }
    public int getScore() { return score; }
}